package cn.tedu.charging.order.RabbitMq;

import cn.tedu.charging.order.config.RabbitMQConfig;
import cn.tedu.charging.order.pojo.po.OrderMQPO;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

//rabbitmq发送者
@Component
public class RabbitMQOrderProducer {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    public void sendOrder(OrderMQPO orderMQPO){
        rabbitTemplate.convertAndSend(RabbitMQConfig.ORDER_EXCHANGE,
                RabbitMQConfig.ROUTING_KEY,
                orderMQPO);
    }
}
